package com.monkeysonnet.b2dFluent;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.CircleShape;

public class CircleFactory extends FixtureFactory<CircleFactory>
{
	private CircleShape _shape;
	
	public CircleFactory()
	{
		this(false);
	}
	
	CircleFactory(boolean managed)
	{
		super(managed);
		_shape = new CircleShape();
		_def.shape = _shape;
	}
	
	public CircleFactory at(Vector2 v)
	{
		_shape.setPosition(v);
		return this;
	}	
	
	public CircleFactory at(float x, float y)
	{
		_shape.setPosition(new Vector2(x, y));
		return this;
	}
	
	@Override 
	public void clear()
	{
		super.clear();		
		_shape.setPosition(Vector2.tmp.set(0, 0));
	}

	@Override
	public void free()
	{
		B2d.free(this);
	}
}
